
local bass = require 'bindings.bass'
local alienex = require 'alienex'
require 'guac.bass_setup'
local setmetatable, print
    = setmetatable, print


module (...)


local sound_proto = {}
local sound_meta = {__index = sound_proto}

function loadfile(path)
  local hsample = bass.SampleLoad(0, path, alienex.lohi2double(0, 0), 0, 10, 0)
  return setmetatable({hsample = hsample}, sound_meta)
end

function sound_proto:play()
  local hchannel = bass.SampleGetChannel(self.hsample, 0)
  bass.ChannelPlay(hchannel, 1)
end
